import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String A = scanner.nextLine();
        String B = scanner.nextLine();
        int[] hash = new int[128];
        for(int i = 0 ; i < B.length() ; i ++) {
            hash[B.charAt(i)]++;
        }
        int[] hash2= new int[128];
        int count = B.length();
        int left = 0;
        int right = 0;
        int c = 0;
        while(right < A.length() - 1) {
            int tmp = right - left;
            if(tmp < count) {
                if(hash[A.charAt(right)] + hash2[A.charAt(right)] > 0) {
                    c++;
                    hash2[right]--;
                }
                right++;
            }
            if(tmp == count ) {
                if(c == count) {
                    System.out.println(true);
                    return;
                }
                if(hash2[A.charAt(left)] < 0) {
                    hash2[A.charAt(left)]++;
                    c--;
                }
                left++;
            }
        }
        System.out.println(false);
    }
}
